home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 2
/
Amiga Tools 2.iso
/
tex
/
macros
/
source
/
contrib
/
supported
/
xypic
/
src
/
xyps-dvi.doc
< prev
next >
Wrap
Text File
|
1995-03-15
|
7KB
|
202 lines
%% $Id: xyps-dvi.doc,v 2.10 1994/06/15 12:46:03 ross Exp $
%%
%% XY-pic ``dvips driver'' PostScript backend support.
%% Copyright (c) 1993-1994 Ross Moore <ross@mpce.mq.edu.au>
%%
%% This file is part of the XY-pic package for graphs and diagrams in TeX.
%% See the companion README and INSTALL files for further information.
%% Copyright (c) 1991-1994 Kristoffer H. Rose <kris@diku.dk>
%%
%% The XY-pic package is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by the
%% Free Software Foundation; either version 2 of the License, or (at your
%% option) any later version.
%%
%% The XY-pic package is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
%% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
%% for more details.
%%
%% You should have received a copy of the GNU General Public License along
%% with this package; if not, write to the Free Software Foundation, Inc.,
%% 675 Mass Ave, Cambridge, MA 02139, USA.
%%
\ifx\xypsdviloaded\relax \message{not reloaded}\endinput \fi
\let\xypsdviloaded=\relax \xycatcodes
\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This included file (version \stripRCS$Revision: 2.10 $) provides \XY-ps
support for the dvips driver by Tomas Rokicki~\cite{dvips} (it has been
tested with dvips version~5.55a).
\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DOCHEADER
|dvips| has three kinds of |\special| which can be used.
The ``dictionary'' file need only be loaded once, at the beginning of the
document.
\DOCMODE(
\xydef@\dvips@@{\gdef\dvitype@{dvips }\dvimessage@
\global\let\PSspecial@=\dvipsSpecial@
\global\let\PSmacro@=\dvipsMacro@
\global\let\PSdict@=\dvipsDict@
\global\let\PSraw@=\dvipsRaw@
\global\let\PSinclude@=\dvipsInclude@
\global\let\xyPSobeylines@=\obeyDVIPSlines@
% \gdef\xyDVIPSheader{\PSmessage{loading header: \xyPSdictname}%
% \expandafter\dvipsInclude@\expandafter{\xyPSdictname}}%
\ifUsePSdict@@
\gdef\firstPS@@{\firstPS@ \includePSmessage@ \includeXYPSdict@ \message{>}}%
\gdef\endXYdict@{\firstPS@}%
\else
\dvipsDict@{200 dict /XYdict exch def %
/xy{XYdict begin countdictstack /xylevel exch def %
xyopen xycolor stopped xyclose cleartomark end}def %
/xyc{{xysetcol}xy}def /xycc{{xychgcol}xy}def %
XYdict begin}%
\gdef\firstPS@@{\firstPS@ \XYdict@}%
\gdef\endXYdict@{\firstPS@\dvipsDict@{end}}\fi
\xyPSshapes@true
\firstPS@@
}
\xywarnifdefined\obeyDVIPSlines@
{\catcode`\^^M=\active
\gdef\obeyDVIPSlines@{\catcode`\^^M=\active \let^^M=\space }}
\xywarnifdefined\dvipsSpecial@
\xywarnifdefined\dvipsMacro@
\xywarnifdefined\dvipsDict@
\xywarnifdefined\dvipsInclude@
\xywarnifdefined\dvipsRaw@
{\catcode`\"=11 \catcode`\!=11 \catcode`\:=11
\gdef\dvipsSpecial@#1{\firstPS@@\special{ps:: SDict begin #1 end}}%
\gdef\dvipsMacro@#1{\firstPS@@\special{" mark{#1}xy}}%
% \gdef\dvipsMacro@#1{\firstPS@@\special{ps: mark{#1}xy}}%
\gdef\dvipsDict@#1{\firstPS@@\special{! mark{#1}stopped cleartomark}}%
\gdef\dvipsInclude@#1{\firstPS@@\special{header=#1}}%
\gdef\dvipsRaw@#1{\firstPS@@\special{ps: SDict begin #1 end}}%
}
\DOCMODE)
Do it now.
\DOCMODE(
\dvips@@
\DOCMODE)
All the \PS\ definitions passed to |dvips| by reading the
dictionary file are stored in a \PS\ dictionary which it defines,
called |SDict|. This must be the current dictionary whenever an \XY-ps
command is to be executed.
This will be the case whenever the |\special{" |{\it commands}|}| or
|\special{! |{\it commands}|}| forms are used, but not when the
|\special{ps:: |{\it commands}|}| form is used.
Thus the |\dvipsSpecial@| macro includes code to open |SDict| and
close it when finished.
\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The |currentpoint| is defined for the ``raw'' specials.
\DOCMODE(
\xydef@\dvipsCurrpt@{%
\def\xyPScurrpt@@{\xyPSraw@{currentpoint /xyYpos exch def /xyXpos exch def}}}
\DOCMODE)
The \PS\ operator called |normalscale| is provided by |dvips|.
It establish the correct scale for drawing using ``raw'' specials.
\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph*{Line styles}\leavevmode
\DOCMODE(
\xywithoption{line}{%
\xyinputorelse@{xyps-l.tex}{\xyerror@{Could not load xyps-l.tex}{}}}
\xycatcodes
\DOCMODE)
\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph*{Rotations and Scaling}\leavevmode
It is necessary to know both the |currentpoint| and the coordinates
|xyXpos| and |xyYpos| of the rotation center, in order to
correctly rotate and scale text boxes.
\DOCMODE(
\xydef@\dvipsRotScale@{%
\def\xyrot@start(##1){currentpoint xyXpos xyYpos
2 copy translate 2 copy 6 2 roll
##1\space neg rotate
3 -1 roll sub neg 3 1 roll sub exch moveto
neg exch neg exch translate }%
\def\xyrot@end{}%
\def\xyscale@start(##1,##2){currentpoint xyXpos xyYpos
2 copy translate 2 copy 6 2 roll
##1\space##2\space scale
3 -1 roll sub neg 3 1 roll sub exch moveto
neg exch neg exch translate }%
\def\xyscale@end{}}
\DOCMODE)
\DOCMODE(
\xywithoption{rotate}{%
\xyinputorelse@{xyps-r.tex}{\xyerror@{Could not load xyps-r.tex}{}}%
\dvipsCurrpt@ \dvipsRotScale@ }
\xycatcodes
\DOCMODE)
\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph*{Colours}
The following <shape> definitions allow the 68 colours known to |dvips|
to be used by name.
This works with versions of |dvips| later than 5.490
(and perhaps some earlier versions),
provided the |color.pro| prolog file is available.
\DOCMODE(
\xywithoption{color}{%
\xyinputorelse@{xyps-c.tex}{\xyerror@{Could not load xyps-c.tex}{}}}
\xycatcodes
\DOCMODE)
\DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph*{The end \& Log}\leavevmode
\DOCMODE(
\xyendinput
% $Log: xyps-dvi.doc,v $
% Revision 2.10 1994/06/15 12:46:03 ross
% Second release 3beta.
% Colour and line style saving works; label colouring bug fixed.
%
% Revision 2.10 1994/06/15 12:46:03 ross
% Second release 3beta.
% Colour and line style saving works; label colouring bug fixed.
%
% Revision 2.9 1994/06/09 14:38:56 ross
% Release 3beta.
% Includes support for special effects: Rotations, Scaling, Line-width, Colour.
% Back-ends are separated into separate files.
% More back-ends are supported, experimentally --- needs testing.
%
% NEW for version 2.9 by Ross Moore 1994/05/30.
\DOCMODE)
\DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Tell Emacs that this is a LaTeX document and how it is formatted:
% Local Variables:
% mode:latex
% fill-column:77
% fill-prefix:""
% End: